<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/dndTemplate.xhtml">

	
	<ui:define name="main">
		

			<p:accordionPanel multiple="true">
				<p:tab title="User management">
					<h:panelGrid columns="2" cellpadding="10">
						<h:form>
						<p:growl id="messages" showDetail="true"/>  
							Name:<p:inputText value="#{myCardsBean.adminUserName}"/>
							Password:<p:inputText value="#{myCardsBean.adminPassword}"/>
							<p:commandButton value="CreateAdmin" action="#{myCardsBean.createAdminUser()}"  update="messages"/>
							<p:commandButton value="Delete"  action="#{myCardsBean.deleteUser()}" update="messages"/>
						
						</h:form>
						
						</h:panelGrid>
				</p:tab>
				<p:tab title="Export">
					<h:panelGrid columns="2" cellpadding="10">
						<h:form>
						<p:growl id="messages" showDetail="true"/>  
							<a href="/rest/Card/query?userName=#{myCardsBean.userName}&amp;sessionID=#{myCardsBean.sessionID}">Cards</a><br/>
							<a href="/rest/Deck/query?userName=#{myCardsBean.userName}&amp;sessionID=#{myCardsBean.sessionID}">Decks</a><br/>
							<a href="/rest/Action/query?userName=#{myCardsBean.userName}&amp;sessionID=#{myCardsBean.sessionID}">Actions</a><br/>
							<a href="/rest/GameItem/Picture/getAllPic?userName=#{myCardsBean.userName}&amp;sessionID=#{myCardsBean.sessionID}">Pictures</a>
						</h:form>
						
						</h:panelGrid>
				</p:tab>
				<p:tab title="Reporting">
					<h:panelGrid columns="2" cellpadding="10" style="text-align:center;">
						<h:form>
						<p:growl id="messages" showDetail="true"/>  
							<table>
							<tr>
							<td colspan="2" align="center">
							<p:barChart id="rateChart" value="#{adminPageBean.ratingChartModel}" legendPosition="ne" title="Card ratings" min="0" max="1000" style="height:400px;width:800px" rendered="#{adminPageBean.renderFinished}"/>  
							</td>
							</tr>
							<tr>
							<td align="center">
								<p:meterGaugeChart id="cardCountChart" value="#{adminPageBean.cardCountModel}" style="width:400px;height:250px" title="Count of cards" label="Cards" rendered="#{adminPageBean.renderFinished}"/>  
							</td>
							<td align="center">
								<p:meterGaugeChart id="deckCountChart" value="#{adminPageBean.deckCountModel}" style="width:400px;height:250px" title="Count of decks" label="Deck" rendered="#{adminPageBean.renderFinished}"/>
							</td>
							</tr>
							</table>  
							<p:commandButton value="Render"  action="#{adminPageBean.renderCharts()}"   update="@form"/>
						</h:form>
					</h:panelGrid>
						
				</p:tab>
				
			</p:accordionPanel>

		

	</ui:define>

</ui:composition>

</html>
